home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / dand / turn1.c < prev   
Encoding:
C/C++ Source or Header  |  1992-12-26  |  1.2 KB  |  58 lines

  1. #include <exec/types.h>
  2. #include <stdio.h>
  3. #include <time.h>
  4. #include <devices/timer.h>
  5.  
  6. time_t StartTime;
  7. int YourTurn();
  8. void GetTheDate();
  9. int YourTurn()
  10. {
  11.   static int DidI=0;
  12.   int Data;
  13.   time_t time2;
  14.   char CMD[80];
  15.   if(!DidI){ GetTheDate(); time(&StartTime);}
  16.   DidI=1;
  17.   getuserdata(7,&Data); time(&time2); if(Data<5){
  18.     SM("",1);
  19.     SM("Your time has expired for today. Your Party must rest.",1);
  20.     return(0);
  21.   }
  22.  
  23.   return(Data);
  24. }
  25.  
  26. char *GetTheDate()
  27. {
  28.   struct tm *tp;
  29.   long t;
  30.   int M,D,Y;
  31.   char Date[9];
  32.   char Day[4],Month[5],Year[3];
  33.   char TheTime[27];
  34.   time(&t);
  35.   tp=localtime(&t);
  36.   sprintf(TheTime,"%s",asctime(tp));
  37.   sprintf(Day,"%.2s",&TheTime[8]);
  38.   sprintf(Month,"%.3s",&TheTime[4]);
  39.   sprintf(Year,"%.2s",&TheTime[22]);
  40.    D=atoi(Day);
  41.    Y=atoi(Year);
  42.  
  43.   if(!strncmp(Month,"Jan",3)) M=1;
  44.   if(!strncmp(Month,"Feb",3)) M=2;
  45.   if(!strncmp(Month,"Mar",3)) M=3;
  46.   if(!strncmp(Month,"Apr",3)) M=4;
  47.   if(!strncmp(Month,"May",3)) M=5;
  48.   if(!strncmp(Month,"Jun",3)) M=6;
  49.   if(!strncmp(Month,"Jul",3)) M=7;
  50.   if(!strncmp(Month,"Aug",3)) M=8;
  51.   if(!strncmp(Month,"Sep",3)) M=9;
  52.   if(!strncmp(Month,"Oct",3)) M=10;
  53.   if(!strncmp(Month,"Nov",3)) M=11;
  54.   if(!strncmp(Month,"Dec",3)) M=12; 
  55.   sprintf(Date,"%02d-%02d-%02d",M,D,Y);
  56.   return(Date);
  57. }
  58.